let babel = require('babel-core');
let types = require('babel-types');
const code = `import {uniq,extend,flatten,cloneDeep} from "lodash"`;
const visitor = {
    ImportDeclaration:{
        enter(path){
            const specifiers = path.node.specifiers;
            const source = path.node.source;
            if(!types.isImportDefaultSpecifier(specifiers[0])){
                const declarations = specifiers.map((specifier,index)=>{
                    return types.ImportDeclaration(
                        [types.importDefaultSpecifier(specifier.local)],
                        types.StringLiteral(`${source.value}/${specifier.local.name}`)
                    )
                });
                path.replaceWithMultiple(declarations);
            }
        }
    }
}
const result = babel.transform(code,{
    plugins:[
        {visitor}
    ]
});
console.log(result.code);